AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
AddCSLuaFile("cl_scoreboard.lua")

include("shared.lua")
include("sv_database.lua")
include("sv_plugins.lua")

local Plugins = {}

function NNRP_LoadPlugins()
	local FoundFiles = file.FindInLua("../gamemodes/nnrp/gamemode/plugins/*.lua")
	
	for k, v in pairs(FoundFiles) do
		NNRP_PluginFileName = "plugins/" .. v
		NNRP_PluginName = string.sub(v, 0, -4)
		table.insert(Plugins, NNRP_PluginName)
		
		print("NNRP - Loaded " .. NNRP_PluginFileName)
		include("plugins/nnrp_hai.lua")
		if NNRP_PluginFileName == "plugins/nnrp_hai.lua" then
			print("************************EQUAL")
		end
	end
end

function GM:PlayerInitialSpawn(ply)
	Database_PlayerJoined(ply)
	ply:SetTeam(1)
end

function GM:PlayerSpawn(ply)
	self.BaseClass:PlayerSpawn(ply)
	GAMEMODE:SetPlayerSpeed(ply, 250, 500)	
end

function GM:PlayerLoadout(ply)
	ply:Give("weapon_physgun")
	ply:Give("gmod_tool")
end

hook.Add("InitPostEntity", "LoadPluginsHook", NNRP_LoadPlugins)
